<template>
  <uni-popup ref="alertDialog" type="dialog">
		<uni-popup-dialog 
		cancelText="取消" 
		confirmText="确定"  
		:content=props.content
		@confirm="confirm"
		@close="close">
		</uni-popup-dialog>
  </uni-popup>
</template>
<script lang="ts" setup>
import { ref,watchEffect } from "vue";
const emit = defineEmits(['close','confirm']);
const alertDialog = ref(null);
const props = defineProps({
  isShow: {
    type:Boolean,
    default: false,
  },
	type:{
	  type:String,
	  default: '',
	},
	content: {
	  type:String,
	  default: '',
	},
	close:{
		type: Object,
		default: () => ({}),
	},
	confirm:{
		type: Object,
		default: () => ({}),
	}
})

watchEffect(() => {
	if(props.isShow){
		alertDialog.value?.open();
	}else{
		alertDialog.value?.close();
	}
});

const close = () => {
	emit('close',props.type)
};
const confirm = () => {
	emit('confirm',props.type)
};
</script>
<style lang="scss">

</style>
